package com.example.apigateway.controller;

import com.example.apigateway.common.RestResponse;
import com.example.apigateway.dao.UserDao;
import com.example.apigateway.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author ：Anitaxiaofeng
 * @description：
 * @create 2018-06-04
 **/
@Controller
public class ApiUserController {

    @Autowired
    private UserService userService;


    private static final Logger LOGGER = LoggerFactory.getLogger(ApiUserController.class);

    @RequestMapping("/test/getusername")
    @ResponseBody
    public RestResponse<String> getusername(Long id) {
        LOGGER.info("start getting username");
        return RestResponse.success(userService.getusername(id));

    }


    @ResponseBody
    @RequestMapping("/test")
    public String test() {
        return "test";
    }
}
